package com.example.zoulx.myapplication

import android.support.annotation.LayoutRes
import android.support.v7.app.AppCompatActivity
import org.chris.quick.b.activities.ThemeActivity
import org.chris.quick.function.IsOkDialog
import org.chris.quick.function.LoadingDialog

/**
 * Created by zoulx on 2017/11/13.
 */
abstract class BaseActivity : ThemeActivity() {
    var isOkDialog = IsOkDialog(activity)
    var loadDialog = LoadingDialog(activity)

    override fun init() {
        if (isUsingBaseLayout && hasTitle()) {
            setBackValid()
        }
        onInit()
        onInitLayout()
        start()
    }

    /**
     * 返回资源文件ID
     *
     * @return
     */
    @LayoutRes
    public abstract override fun onResultLayoutResId(): Int

    /**
     * 初始化操作
     */
    abstract fun onInit()

    /**
     * 初始化布局
     */
    abstract fun onInitLayout()

    /**
     * 开始业务逻辑
     */
    abstract fun start()
}